package com.spring.cloud.study.controller;

import com.spring.cloud.study.common.annotation.LogAspect;
import com.spring.cloud.study.utils.data.R;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * Created with IntelliJ IDEA.
 * User: 齐丹枫
 * Date: 2018/2/27
 * Time: 17:33
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@RestController
@RequestMapping("/security/")
public class SysUserController {


    @RequestMapping(value = "/principal",method = RequestMethod.GET)
    public Principal user(Principal user){
        return  user;
    }

    @RequestMapping("/test1")
    @LogAspect("test")
  //  @PreAuthorize("hasAuthority('1111')")
    public R test1() throws Exception {
        return R.ok();
    }
    @RequestMapping("/test2")
    @LogAspect("test")
    //  @PreAuthorize("hasAuthority('1111')")
    public R test2() throws Exception {
        return R.ok();
    }




}
